package Iterator;

import java.util.Iterator;

public class DinnerMenuIterator implements Iterator{
    Menu[] menuItems;
    int position=0;
    public DinnerMenuIterator(Menu[] menuItems){
        this.menuItems=menuItems;
    }
    @Override
    public boolean hasNext() {
        if (position>=menuItems.length||menuItems[position]==null){
            return false;
        }
        return true;
    }

    @Override
    public Object next() {
        Menu menuItem=menuItems[position];
        position++;
        return menuItem;
    }
}
